/*
 * Created on 2006-6-27
 */
package entity;

public class Velocity {
	double xSpeed;

	double ySpeed;

	static double sig = 1; 
	
	public Velocity(double vx, double vy) {
		this.xSpeed = vx;
		this.ySpeed = vy;
	}
	
	public double getVx() {
		return this.xSpeed;
	}

	public double getVy() {
		return this.ySpeed;
	}

	public String toString() {
		return "(" + this.xSpeed + "," + this.ySpeed + ")";
	}

	public double oneValueSpeed() {
		return Math.sqrt(Math.pow(this.xSpeed, 2) + Math.pow(this.ySpeed, 2));
	}

	//if the speed change is more than $sig$
	//the change is significant
	public boolean sameWith(Velocity as) {
		double delta = Math.abs(this.xSpeed - as.xSpeed)
				+ Math.abs(this.ySpeed - as.ySpeed);
		// System.out.println(delta);
		if (delta < sig) {
			return true;
		} else {
			return false;
		}
	}

	

}
